using Common.Communal;
using MediatR;
using Sell.Api.Write.Application.Command.SalesManagementCommand;
using Sell.Services.Verifications;

namespace Sell.Api.Write.Application.CommandHandlers.SalesManagementCommandHandlers
{
    public class VerificationUpdateReviewStatusCommandHandler : IRequestHandler<VerificationUpdateReviewStatusCommand, ApiResult<int>>
    {
        private readonly IVerificationServices _verificationServices;

        public VerificationUpdateReviewStatusCommandHandler(IVerificationServices verificationServices)
        {
            _verificationServices = verificationServices;
        }

        /// <summary>
        /// 修改采购核价审核状态
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<ApiResult<int>> Handle(VerificationUpdateReviewStatusCommand request, CancellationToken cancellationToken)
        {
            return await _verificationServices.UpdateReviewStatus(request.Id, request.ReviewStatus);
        }
    }
}

